<title>会议信息</title>
<div class="hidden" id="event" data-event-id=<%= params[:event_id]%>></div>
<div class="hidden" id="event-question" data-event-question-id=<%= params[:event_question_id]%>></div>

<header>
  <nav class="navbar navbar-static-top">
    <a href="">
      <i class="fa fa-angle-left fa-2x"></i>
    </a>
    <h1 class="navbar-title text-center">会议信息</h1>
  </nav>
</header>
<div class="container-fluid">
  <div class="row">
    <div class="col-xs-12 no-padding pic-area">
      <%= image_tag "client/questions/question_bg.png", class: "img-responsive"%>
      <div class="close-button">
        <a href="javascript:;" onclick="javascript:history.back(-1);" style="color: #fff;">
          <i class="fa fa-times"></i>
        </a>
      </div>

      <div class="question-text-area">
        <%= @current_event_question.name %>
      </div>
    </div>
    <div class="col-xs-12">
      <p class="question-title">现场提问</p>
      <ul class="question-list">
        <% @questions.each do |question| %>
          <li>
            <div class="question-img">
              <%
                img = if question.attendee.avatar.exists?
                     question.attendee.avatar.url
                   elsif question.attendee.photo.exists?
                     question.attendee.photo.url(:square)
                   end
              %>
              <%= image_tag img||"client/questions/user_photo.png", class: "img-responsive"%>
            </div>
            <div class="question-content">
              <p><%= question.question_content %></p>
              <span>
                <i class="fa fa-clock-o"></i>
                <%
                  time_ago = (Time.new - question.created_at).to_i
                  if time_ago<60
                    time = "#{time_ago}秒前"
                  elsif time_ago<3600
                    time = "#{time_ago/60}分钟前"
                  else
                    time = "#{time_ago/3600}小时前"
                  end
                %>
                <%= time %>
              </span>
              <span class="separate-area">|</span>
              <span class="cursor-pointer praise-button" data-question-id=<%= question.id %>>
              <% if AttendeePraisesQuestion.get_praise(@current_attendee, question).present? %>
                <i class="fa fa-thumbs-o-up gray-icon"></i>
              <% else %>
                <i class="fa fa-thumbs-o-up red-icon"></i>
              <% end %>
              <span class="praise-count"><%= question.praise_count %></span></span>
            </div>
          </li>
        <% end %>
      </ul>
    </div>
  </div>
</div>
<div class="query-question-area">
  <%= form_tag(client_event_event_question_questions_path(current_event, params[:event_question_id]), method: "POST") do %>
    <input class="question-box" placeholder="请输入您的问题，限24个汉字" type="text" name="question"></input>
    <button class="submit-button" type="submit">发送</button>
  <% end %>
</div>

<% content_for :style do %>
  <%= stylesheet_link_tag 'client_questions', media: 'all' %>
<% end %>

<% content_for :script do %>
<%= javascript_include_tag 'client_questions' %>
<% end %>
